﻿using System;

namespace String_2
{
    public class Solution {
        public void ReverseString(char[] s) {
            int length = s.Length;
            int i = 0;
            int j = length-1;
            char temp;
            for (int k = 0; k < length; ++k) {
                temp = s[i];
                s[i] = s[j];
                s[j] = temp;
                i+=1;
                j-=1;
                if (i == j || i - j == 1) break;
            }
        }
        static void Main(string[] args)
        {
            string str1 = "I love you.";
            Console.WriteLine("测试样例："+str1);
            char[] str = str1.ToCharArray();
            new Solution().ReverseString(str);
            Console.Write("输出结果：");
            for (int i = 0; i < str.Length; i++)
            {
                Console.Write(str[i]);
            }
        }
    }
}